home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interplay's Learn to Program Basic (Review Copy)
/
Learn to Program Basic Review Copy (Interplay)(June 23, 1998).ISO
/
pc
/
ltpbasic
/
refxmpl
/
random.bas
< prev
next >
Wrap
BASIC Source File
|
1998-04-07
|
1KB
|
72 lines
Rem This program uses the Random function
Rem to simulate the "paper/scissors/rock" game
Dim A$(3)
A$(1) = "Paper"
A$(2) = "Scissors"
A$(3) = "Rock"
CLS
Print "Welcome to the game of"
Print "Paper, Scissors, Rock."
Print
Let repeat = 1
While repeat = 1
Print "Select a number for your choice"
Print " 1. Paper"
Print " 2. Scissors"
Print " 3. Rock"
Input player
Print "You have selected ";
Print A$(player)
Let Computer = Random (1,3)
Print "The computer selects ";
Print A$(computer)
If player = computer Then
Print "It's a tie!"
Endif
If player > computer then
If player + computer <> 4 Then
Print "You win!"
Endif
EndIf
If computer > player then
If player + computer <> 4 Then
Print "The computer wins."
Endif
Endif
If player > computer then
If player + computer = 4 Then
Print "The computer wins."
Endif
Endif
If computer > player then
If player + computer = 4 Then
Print "You win!"
Endif
Endif
Print "Want to play again?"
Input answer$
If Left$(answer$,1) = "y" Then
CLS
Let repeat = 1
Else repeat = 0
Endif
Wend
Print "Thanks for playing."
Print "Good-bye to you."
End